home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_128 / mrbackup / mrbackup.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  6KB  |  196 lines

  1. /* MRBackup - include file for global data and definitions.
  2.  * Filename:    MRBackup.h
  3.  * Date:        08/22/87
  4.  *
  5.  * History:        (most recent change first)
  6.  *
  7.  * 09/03/87 -MRR- V1.3: Changed window version and date.
  8.  */
  9.  
  10. /* Main.c defines MAIN.  It should not defined elsewhere. */
  11.  
  12. #ifdef MAIN
  13. #define EXTERN 
  14. #else
  15. #define EXTERN extern
  16. #endif
  17.  
  18. #include <exec/memory.h>
  19. #include <exec/types.h>
  20. #include <intuition/intuition.h>
  21. #include <libraries/dos.h>
  22. #include <libraries/dosextens.h>
  23. #include <stdio.h>
  24. #include <ctype.h>
  25. #include <setjmp.h>
  26. #include <time.h>
  27. #include <functions.h>
  28.  
  29. #include "gadget.h"
  30. #include "menu.h"
  31.  
  32. /* Constants */
  33.  
  34. #define false    0        /* for short parameter requirements */
  35. #define true    1        /* for short parameter requirements */
  36. #define BUFMAX (32L * 1024L) /* max size for copy/compress buffer */
  37. #define LINES_PER_PAGE  60
  38.  
  39. #define VOLUME_MAX    32    /* max characters in volume name */
  40. #define PATH_MAX    256 /* max characters in pathname (very arbitrary) */
  41.  
  42. /* Define error recovery constants.  Note that these are all powers
  43.  * of 2 to allow creating 'sets' of allowable options during the
  44.  * recovery prompt.
  45.  */
  46.  
  47. #define NERRCODE            5    /* number of error recovery codes */
  48.  
  49. #define ERR_NONE            0    /* what we want ALL the time :-) */
  50. #define ERR_ABORT            1    /* give up the ship */
  51. #define ERR_RETRY_FILE        2    /* let's try that file one more time */
  52. #define ERR_RESTART_VOLUME     4    /* for media errors on output floppy */
  53. #define ERR_IGNORE            8    /* ignore this error and trudge on */
  54.  
  55. /* Macros */
  56.  
  57. /* determine if a menu item is "checked" */
  58.  
  59. #define GadgetString(g) ((struct StringInfo *) g->SpecialInfo)->Buffer
  60. #define IsChecked(item) (item->Flags & CHECKED == CHECKED)
  61.  
  62. typedef struct t_pattern {
  63.     struct t_pattern * next_pattern;
  64.     char *pattern;
  65.     } T_PATTERN;
  66.  
  67. /* The following structure is used to link file and directory node
  68.  * information into a doubly-linked list.  This provides a way to
  69.  * defer processing of sub-directory nodes until all files in a
  70.  * current directory are processed.  As nodes are "consumed", they 
  71.  * are returned to free memory.
  72.  */
  73.  
  74. typedef struct t_file {
  75.     struct t_file  *previous,*next;
  76.     char               *filename;
  77.     USHORT            blocks;
  78.     BOOL             is_dir;            /* TRUE => it's a directory */
  79.     } T_FILE;
  80.  
  81. /* The following structure links lists of T_FILE nodes. */
  82.  
  83. typedef struct t_file_list {
  84.     T_FILE *first_file;
  85.     T_FILE *last_file;
  86.     } T_FILE_LIST;
  87.  
  88. /* External and forward function declarations */
  89.  
  90. extern char       *calloc(), *index(), *rindex();
  91. extern long       DiskBlocks();
  92. extern int          errno;
  93. T_FILE               *FindFile();
  94.  
  95. /* External data */
  96.  
  97. extern struct Gadget StopGad;
  98. extern struct Menu Titles[];
  99. extern struct MenuItem Items[];
  100. extern struct Window *pathwindow;
  101.  
  102. /* Global data */
  103.  
  104. #ifdef DEBUG
  105. EXTERN struct FileHandle *debugconsole;
  106. EXTERN char debugmsg[512];
  107. #endif
  108.  
  109. EXTERN short back;                    /* backup disk serial number */
  110. EXTERN UBYTE *buffer;                /* file copy/cmprs buffer (AllocMem) */
  111. EXTERN ULONG bufsize;                /* size of buffer allocated */
  112. EXTERN struct FileHandle *console;    /* for informative messages */
  113. EXTERN char conmsg[512];
  114. EXTERN T_FILE *current_dir = NULL;    /* current directory node */
  115.  
  116. EXTERN char    destpath[PATH_MAX+1];
  117. EXTERN char destvol[VOLUME_MAX+1];
  118.  
  119. EXTERN BOOL exclude_has_changed;    /* true when new path specified */
  120. EXTERN T_PATTERN *excludelist, *lastexclude;
  121. EXTERN char excludepath[81];         /* list of file patterns to exclude */
  122. EXTERN struct IntuitionBase *IntuitionBase;
  123.  
  124. EXTERN USHORT level;                /* file nesting level */
  125. EXTERN USHORT linecount;            /* number of lines in listing */
  126. EXTERN FILE *listing;
  127. EXTERN T_FILE_LIST main_list;
  128. EXTERN struct Window *mywindow;
  129.  
  130. EXTERN struct DateStamp *now, *since; /* for date comparisons */
  131. EXTERN short size;                    /* floppy blocks remaining */
  132. EXTERN char    srcpath[PATH_MAX];
  133. EXTERN char    srcvol[VOLUME_MAX+1];    /* source volume name */
  134. EXTERN char temp[256];
  135.  
  136. /* The following flags suppress repetition of spoken
  137.  * messages.  After all, let's not over-do it.
  138.  */
  139.  
  140. EXTERN UBYTE at_your_service;
  141.  
  142. /* Preset data */
  143.  
  144. #ifdef MAIN
  145.  
  146. char backpath[81] = "DF0:";            /* where backups go and restores
  147.                                        come from. */
  148. char destdrive[5] = "DF0:";
  149. USHORT do_compress = 1;                /* compression flag */
  150. USHORT do_listing = 1;                /* listing flag */
  151. USHORT do_speech = 1;                /* speech flag */
  152. char *erropts[NERRCODE] = {            /* error recovery options */
  153.     "No error", 
  154.     "Abort processing",
  155.     "Retry this file",
  156.     "Restart the output volume",
  157.     "Ignore this error"
  158.     };
  159.  
  160. char homepath[81] = "DH0:";            /* where files are backed up from and
  161.                                        restored to. */
  162. char listpath[81] = "PRT:";            /* where we send all of that vital
  163.                                        information about backups */
  164. struct NewWindow    nw = {             /* New window structure */
  165.     0,0,640,200,0,1,
  166.  
  167. /* IDCMP Flags */
  168.  
  169.     MENUPICK | MOUSEBUTTONS | DISKINSERTED |
  170.     CLOSEWINDOW | GADGETDOWN | GADGETUP | REQSET,
  171.  
  172. /* Flags */
  173.     WINDOWCLOSE | WINDOWDEPTH | ACTIVATE ,
  174.  
  175.     NULL,                            /* First gadget */
  176.     NULL,                            /* Checkmark */
  177.     (UBYTE *)"MRBackup Version 1.3  09/03/87",/* Window title */
  178.     NULL,                            /* No custom streen */
  179.     NULL,                            /* Not a super bitmap window */
  180.     0,0,640,200,                    /* Not used, but set up anyway */
  181.     WBENCHSCREEN
  182. };
  183. #else
  184. /* Declare preset external data without the presets. */
  185. extern char backpath[81];
  186. extern char destdrive[5];
  187. extern USHORT do_compress;            /* compression flag */
  188. extern USHORT do_listing;            /* listing flag */
  189. extern USHORT do_speech;            /* speech flag */
  190. extern char destdrive[];
  191. extern char *erropts[];
  192. extern char homepath[81];
  193. extern char listpath[81];
  194. extern struct NewWindow nw;
  195. #endif
  196.